package com.proton.carepatchtemp.login.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.proton.carepatchtemp.R;
import com.proton.carepatchtemp.activity.LoginInternationalActivity;
import com.proton.carepatchtemp.application.VCare;
import com.proton.carepatchtemp.base.BaseActivity;
import com.proton.carepatchtemp.constant.Extras;
import com.proton.carepatchtemp.utils.SpUtils;
import com.proton.carepatchtemp.utils.eventbus.MainEvent;


public class LoginFirstActivity extends BaseActivity implements View.OnClickListener {

    private Button firstLoginBtn;
    private Button firstRegisterBtn;
    /**
     * Sign in or register
     */
    private TextView mTvSwitchEdition;


    @Override
    public void dealEvent(MainEvent event) {

    }

    @Override
    public void setListener() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_first_pager);
        boolean killall = getIntent().getBooleanExtra(Extras.KILLALL, false);
        if (killall) {
            VCare.get().closeAllExpect(LoginFirstActivity.this);
        }
        initView();
        mTvSwitchEdition.setOnClickListener(v -> {
            SpUtils.saveBoolean(Extras.APP_EDITION, true);
            jumpToActivty(LoginInternationalActivity.class);
            overridePendingTransition(R.anim.umeng_socialize_fade_in, R.anim.umeng_socialize_fade_out);
            finish();
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_login_first:
                Intent intent = new Intent(LoginFirstActivity.this, LoginAuthActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_register_first:
                Intent intent1 = new Intent(LoginFirstActivity.this, RegisterActivity.class);
                startActivity(intent1);
                break;
            default:
                break;
        }
    }

    private void initView() {
        firstLoginBtn = findViewById(R.id.btn_login_first);
        firstRegisterBtn = findViewById(R.id.btn_register_first);
        firstLoginBtn.setOnClickListener(this);
        firstRegisterBtn.setOnClickListener(this);
        mTvSwitchEdition = findViewById(R.id.tv_switch_edition);
    }


    @Override
    public void onEventMainThread(MainEvent event) {

    }
}
